package org.jcnc.staffingsystem.stage;

import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.SplitPane;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import javafx.stage.Stage;

public class MainScene extends Stage {
    public MainScene() {
        HBox mainBox = new HBox();
        VBox leftBox = new VBox();
        BorderPane rightBorderPane = new BorderPane();
        rightBorderPane.setPadding(new Insets(20));


        VBox buttonBox = new VBox();
        //TODO: 改名字
        Button home = new Button("首页");
        home.setOnAction(event -> {
            this.setTitle("培训系统管理-主页面");
            VBox homeBox = new VBox();
            rightBorderPane.setCenter(homeBox);

        });

        Button employeeInformation = new Button("员工信息");
        employeeInformation.setOnAction(event -> {
            this.setTitle("培训系统管理-员工信息");
            rightBorderPane.setCenter(new EmployeeInformationBox());
        });

        Button departmentInformation = new Button("部门信息");
        departmentInformation.setOnAction(event -> {
            this.setTitle("培训系统管理-部门信息");
            rightBorderPane.setCenter(new DepartmentInformationBox());
        });

        Button classArrangement = new Button("课程管理");
        classArrangement.setOnAction(event -> {
            this.setTitle("培训系统管理-课程管理");
            rightBorderPane.setCenter(new ClassBox());
        });

        Button employeeTrainingArrangement = new Button("员工培训\n安排");
        employeeTrainingArrangement.setOnAction(event -> {
            this.setTitle("培训系统管理-员工培训安排");
            rightBorderPane.setCenter(new EmployeeTrainingArrangementsBox());
        });

        home.setMinSize(90, 50);
        employeeInformation.setMinSize(90, 50);
        departmentInformation.setMinSize(90, 50);
        classArrangement.setMinSize(90, 50);
        employeeTrainingArrangement.setMinSize(90, 50);
        home.setStyle(" -fx-border-color: transparent;-fx-background-color: rgba(135, 206, 235, 0.5);");
        employeeInformation.setStyle(" -fx-border-color: transparent;-fx-background-color: rgba(135, 206, 235, 0.5);");
        departmentInformation.setStyle(" -fx-border-color: transparent;-fx-background-color: rgba(135, 206, 235, 0.5);");
        classArrangement.setStyle(" -fx-border-color: transparent;-fx-background-color: rgba(135, 206, 235, 0.5);");
        employeeTrainingArrangement.setStyle(" -fx-border-color: transparent;-fx-background-color: rgba(135, 206, 235, 0.5);");


        leftBox.getChildren().addAll(home, employeeInformation, departmentInformation, classArrangement, employeeTrainingArrangement);
        leftBox.setPadding(new Insets(20));
        leftBox.setSpacing(50);
        leftBox.setPrefWidth(Region.USE_COMPUTED_SIZE);  // 设置宽度为自适应大小
        leftBox.setPrefHeight(Region.USE_COMPUTED_SIZE); // 设置高度为自适应大小
        leftBox.setMaxWidth(Double.MAX_VALUE);           // 允许水平方向上扩展
        leftBox.setMaxHeight(Double.MAX_VALUE);          // 允许垂直方向上扩展
        leftBox.setPrefSize(500,1000);


        mainBox.getChildren().addAll(leftBox, rightBorderPane);
        mainBox.setSpacing(20);
        Scene scene = new Scene(mainBox, 1000, 600);

        this.setScene(scene);
        this.setTitle("培训系统管理-主页面");
        this.show();
    }
}
